/*
 * Copyright 2017-8-30 13:56:25 The JA-SIG Collaborative. All rights reserved.
 * distributed with thi file and available online at
 */
package com.lap.scp.admin.core.impl;

import java.util.Collections;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.lap.scd.commons.core.exception.ManagerException;
import com.lap.scd.commons.page.Page;
import com.lap.scp.admin.core.AccessLogsManager;
import com.lap.scp.admin.dal.AccessLogsDAO;
import com.lap.scp.admin.domain.AccessLogsDO;
import com.lap.scp.admin.query.AccessLogsQueryDO;

/**
 * <pre>
 * // TODO 注释
 * </pre>
 * 
 * @author 系统自动生成 Exp
 * @Date 2017-8-30 13:56:25
 * @since 1.0
 */
@Service("accessLogsManager")
public class DefaultAccessLogsManager implements AccessLogsManager {

	@Resource
	private AccessLogsDAO accessLogsDAO;

	@Override
	public int deleteById(int accessLogsId) throws ManagerException {
		return accessLogsDAO.deleteById(accessLogsId);
	}

	@Override
	public void insertAccessLogs(AccessLogsDO accessLogsDO) throws ManagerException {
		accessLogsDAO.insertAccessLogs(accessLogsDO);
	}

	@Override
	public List<AccessLogsDO> queryPage(Page page, AccessLogsQueryDO queryDO) throws ManagerException {
		int count = accessLogsDAO.countPage(queryDO);
		if (count <= 0) {
			return Collections.emptyList();
		} else {
			page.setTotalItem(count);
			return accessLogsDAO.queryPage(page, queryDO);
		}
	}

}
